<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>修改密码</title>
		<script src="../js/base.js"></script>
	</head>
	<style type="text/css">
        .left_arrow{
            width: 23px;
            height: 25px;
            top: 13px;
            left: 15px;
            background-size: 50%;
            position: absolute;
            background-image: url(../img/arrow_left.png);
            z-index: 100;
        }
		.top{
		    height: 50px;
		    line-height: 50px;
		    background-color: #424242;
		    text-align: center;
		}
		.account_item{
		    padding: 10px 15px;
		    background-color: #393939;
		}
		.account_item input{
            box-sizing: border-box;
            width: 100%;
            text-align: left;
            font-size: 14px;
            color: #efefef;
            background-color: #393939;
		}
	</style>
	<body>
	<form id="updatePwd" action="updatePwd" method="post"  >
		<div class="top">
            <span class="left_arrow bgBox" onclick="javascript:history.back(-1);"></span>
			修改密码
		</div>
		<input type="hidden" name="mobile" value="${user.mobile}" />
		<div class="account_item mt10 color999 f14">
			<input type="password" maxlength="11" id="oldPwd" name="oldPwd" maxlength="12"   placeholder="请输入旧密码" ms-duplex-string="usermobile" />
		<span id="errSpan1"><font color="red"> ${msg!""}</font></font></span>
		</div>
		<div class="account_item mt10 color999 f14">
			<input type="password" name="newPwd1" maxlength="11"  id="newPwd"  maxlength="12"  placeholder="请输入新密码" ms-duplex-string="usermobile"/>
			<span id="errSpan2"></span>
		</div>
		<div class="account_item mt10 color999 f14">
			<input type="password" name="newPwd"  maxlength="11"  id="rePwd"  maxlength="12"  placeholder="请确认密码" ms-duplex-string="usermobile"/>
		<span id="errSpan3"></span>
		</div>
		<div class="btnBox mt30 w100">
			<div class="bgcolor_ora color_ef br5 tc" onclick="updatePwd()"; >确认修改</div>
		</div>
		</form>
	</body>
	
<script>
	 $("#oldPwd").blur(function(){ 
	  $("#errSpan1").html("");
		var oldPwd= $("#oldPwd").val();
		var msg = "";
		if (isEmpty(oldPwd)) {
			msg = "密码不能为空";
			$("#errSpan1").html("<font color='red'>" + msg + "</font>");
			return;
		}
	 });
	 $("#rePwd").blur(function(){
	  $("#errSpan1").html("");
	  $("#errSpan2").html("");
	  $("#errSpan3").html("");
	 	var oldPwd= $("#oldPwd").val();
		var rePwd = $("#rePwd").val();
		var newPwd= $("#newPwd").val();
		var msg = "";
		if (isEmpty(oldPwd)) {
            msg = "密码不能为空";
            $("#errSpan1").html("<font color='red'>" + msg + "</font>");
            retrun;
        }
});
	
	$("#newPwd").blur(function(){ 
	  $("#errSpan2").html("");
		var newPwd = $("#newPwd").val();
	if (isEmpty(newPwd)) {
		msg = "密码不能为空";
		$("#errSpan2").html("<font color='red'>" + msg + "</font>");
		return;
	}
	var msg1 = "密码是6-12位数字、字母组合";
	var reg = /^[0-9a-zA-Z]+$/;
	if (!reg.test(newPwd)) {
		$("#errSpan2").html("<font color='red'>" + msg1 + "</font>");
		return;
	}
	var min = 6;
	var max = 12;
	if (newPwd.length < min || newPwd.length > max) {
		$("#errSpan2").html("<font color='red'>" + msg1 + "</font>");
		return;
	}
	});

function isEmpty(obj) {
	if (typeof obj == "undefined" || obj == null || obj == "") {
		return true;
	} else {
		return false;
	}
}

function updatePwd() {
	var oldPwd= $("#oldPwd").val();
    var newPwd = $("#newPwd").val();
    var rePwd = $("#rePwd").val();
	var msg = "";
	if (isEmpty(oldPwd)) {
		msg = "密码不能为空";
		$("#errSpan1").html("<font color='red'>" + msg + "</font>");
		return;
	}
	if (newPwd != rePwd) {
		msg = "两次密码不一致";
		$("#errSpan2").html("<font color='red'>" + msg + "</font>");
		return;
	}
	if (isEmpty(newPwd)) {
		msg = "密码不能为空";
		$("#errSpan3").html("<font color='red'>" + msg + "</font>");
		return;
	}
	 msg = "密码是6-12位数字、字母组合";
	var reg = /^[0-9a-zA-Z]+$/;
	if (!reg.test(newPwd)) {
		$("#errSpan3").html("<font color='red'>" + msg + "</font>");
		return;
	}
	var min = 6;
	var max = 12;
	if (newPwd.length < min || newPwd.length > max) {
		$("#errSpan3").html("<font color='red'>" + msg	 + "</font>");
		return;
	}
	$("#updatePwd").submit();
}

function limitInput(value) {

}
</script>	
</html>
